﻿@using KRM.Core

@using KRM.Core.Library
@model System.Collections.Generic.List<KRM.Core.tblBookNotification>

@{
    ViewBag.Title = "All notification";
    Layout = "/views/shared/_HRLayout.cshtml";
    var currentUser = Users.Current(User.Identity.Name);
    ViewBag.UrlLink = "home";
}
<div class="row">
    <div class="col-md-12">
        <!-- BEGIN PAGE TITLE & BREADCRUMB-->
        <h3 class="page-title">
            Notification <small>All notification</small>
        </h3>
        <ul class="page-breadcrumb breadcrumb">
            <li>
                <i class="icon-home"></i>
                <a href="/Home">Home</a> 
                <span class="icon-angle-right"></span>
            </li>
            <li>
                <a href="#">Notification</a>
            </li>
        </ul>
        <!-- END PAGE TITLE & BREADCRUMB-->
    </div>
</div>
<div class="row">
    <div class="col-md-12">
        @Html.Partial("Partial/_MessageResult")
    </div>
    <div class="row " >
            <form class="form-horizontal col-md-6" id="frFilterNotification" action="/Notification/AllBookNotification" method="GET">
            <input type="hidden" name="PersonalId" value="@ViewBag.PersonalId"/>
            <label class="control-label col-md-4">Filter by date:</label>
            <div class="input-icon col-md-4">
                <i class="icon-calendar"></i>
                <input name="date" class="form-control date-picker" size="16" type="text" value="@(Request["date"]??DateTime.Now.ToString("MM/dd/yyyy"))" data-date="@DateTime.Now.ToString("MM/dd/yyyy")" data-date-format="mm/dd/yyyy" data-date-viewmode="years">
            </div>
            <div class="col-md-4"><button type="submit" class="btn blue">Filter <i class="m-icon-swapright m-icon-white"></i></button></div>
        </form>
        <form action="/Notification/MarkAllReadBookNotification" class="col-md-6" method="POST">
            <input type="hidden" name="PersonalId" value="@ViewBag.PersonalId"/>
            <div class="col-md-12" style="text-align: right"><button type="submit"  class="btn green" onclick="javascript:return confirm('Are you sure?');">Mark All Read</button></div>
        </form>
    </div>
    <div class="col-md-12"> <table class="table table-striped table-bordered table-hover dataTable">
                          <thead>
                              <tr>
                                  <th>Notifications</th>
                                  <th>Status</th>
                                  <th>Date create</th>
                              </tr>
                          </thead>
                          <tbody>
                              @foreach (var item   in Model)
                              {
                                  var owner = @item.tblBook.PersonalId == @currentUser.HRPersonalId;
                                  <tr class="@(item.Read==true?"":"danger")">
                                      <td style="text-align: left">@item.tblPersonalFrom.FullName 
                                      @Html.Raw(@item.HtmlNotification(User.Identity.Name))
                                      </td>
                                      <td style="text-align: center">@(item.Read==true?"read":"unread")</td>
                                      <td style="text-align: center">@item.DateCreated</td>
                                  </tr>
                              }
                          </tbody>
           </table>
    </div>
</div>